package com.itao.controller;

import com.itao.annotation.ExcelExport;
import com.itao.entity.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author sjt
 * @Date 2025/2/12 15:10
 */
@RestController
public class ExcelController {

    @ExcelExport(
            value = "导出",
            returnType = User.class,
            dynamicHead = true,
            headBeanName = "dynamicHead",
            handlerBeanName = "writeHandlerBean"
    )
    @GetMapping("/export")
    public List<User> export() {
        List<User> list = new ArrayList<>();
//        list.add(new User("张三", "北京"));
//        list.add(new User("李四", "上海"));
//        list.add(new User("王五", "深圳"));
        return list;
    }
}
